import random

setGlobalDuration(30)

env2 = genAdsr()

tapTable = genDataTable([1]*16)

# values to assign to a parameter on each successive tap 
lineVar = genDataTable([1,.96,.91,.85,.8,.75,.7,.64,.58,.5,.42,.34,.26,.2,.14,.1])

metro(bus='metro', tempo=120)

beginSequencer(input='metro', table=tapTable)

seqParameterTable('i1', lineVar) # modify a parameter on each tap
notes = 5
pitchs = [random.randint(180,190)*1 for x in range(notes)]
durs = [random.randint(1,10)*.125 for x in range(notes)]

linsegr(bus='index', i1=1, dur1=.1, i2=.1, duration=.2) # 'i1' parameter to modify
freqMod(pitch=pitchs, amplitude=.1, starttime=0, duration=durs, envelope=env2,
        pan=[0,.25,.5,.75,1], index=30, indexVar='index')
endSequencer()

startCsound()